From dc3ce7e365dcfbf8089b643e1fa4e4cd88dc9d6d Mon Sep 17 00:00:00 2001
From: Mark Liversedge <liversedge@gmail.com>
Date: Fri, 17 Jan 2020 16:04:27 +0000
Subject: Connect with Strava

.. the authorise button on the add cloud wizard now
   shows a 'Connect with Strava' icon

.. all other services continue to have a button that
   is labelled 'Authorise'

.. this is needed to comply with the Strava API application
   guidelines.

diff --git a/src/Cloud/AddCloudWizard.cpp b/src/Cloud/AddCloudWizard.cpp
index db1aea7f1..6deb107bd 100644
--- a/src/Cloud/AddCloudWizard.cpp
+++ b/src/Cloud/AddCloudWizard.cpp
@@ -27,6 +27,7 @@
 #include "OAuthDialog.h"
 
 #include <QMessageBox>
+#include <QPixmap>
 #include <QRegExp>
 
 // WIZARD FLOW
@@ -271,13 +272,15 @@ AddAuth::AddAuth(AddCloudWizard *parent) : QWizardPage(parent), wizard(parent)
     pass = new QLineEdit(this);
     pass->setEchoMode(QLineEdit::Password);
     pass->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-    auth = new QPushButton(tr("Authorise"), this);
-    auth->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     token = new QLabel(this);
     token->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     message = new QLabel(this);
     message->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
+    // is there an icon for the authorise button?
+    auth = new QPushButton(tr("Authorise"), this);
+    auth->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
     // labels
     comboLabel = new QLabel("");
     urlLabel = new QLabel(tr("URL"));
@@ -367,6 +370,24 @@ AddAuth::initializePage()
     // clone to do next few steps!
     setSubTitle(QString(tr("%1 Credentials and authorisation")).arg(wizard->cloudService->uiName()));
 
+    // icon on the authorize button
+    if (wizard->cloudService && wizard->cloudService->authiconpath() != "") {
+
+        // scaling icon hack (193x48 is strava icon size)
+        QPixmap pix(wizard->cloudService->authiconpath());
+        QIcon authicon(pix.scaled(193*dpiXFactor, 48*dpiXFactor));
+        auth->setIconSize(QSize(193*dpiXFactor, 48*dpiYFactor));
+
+        // set the pushbutton
+        auth->setText("");
+        auth->setIcon(authicon);
+    } else {
+
+        // standard pushbutton (reset after used by strava)
+        auth->setText(tr("Authorise"));
+        auth->setIcon(QIcon());
+    }
+
     // show  all the widgets relevant for this service and update the value from the
     // settings we have collected (which will have been defaulted).
     QString cname;
diff --git a/src/Cloud/CloudService.h b/src/Cloud/CloudService.h
index b9c14c90c..95ebcc5ec 100644
--- a/src/Cloud/CloudService.h
+++ b/src/Cloud/CloudService.h
@@ -95,6 +95,9 @@ class CloudService : public QObject {
         // need a logo, we may resize but will keep aspect ratio
         virtual QImage logo() const = 0;
 
+        // an icon to put on the authorize button (mandated by strava guidelines)
+        virtual QString authiconpath() const { return QString(""); }
+
         // register with capabilities of the service - emerging standard
         // is a service that allows oauth, query and upload as well as download
         enum { OAuth=0x01, UserPass=0x02, Upload=0x04, Download=0x08, Query=0x10} capa_;
diff --git a/src/Cloud/Strava.h b/src/Cloud/Strava.h
index 1c51a5da4..45ee2f57c 100644
--- a/src/Cloud/Strava.h
+++ b/src/Cloud/Strava.h
@@ -45,6 +45,8 @@ class Strava : public CloudService {
 
         //virtual int capabilities() const { return OAuth | Upload | Download | Query ; } // Default
 
+        QString authiconpath() const { return QString(":images/services/strava_connect.png"); }
+
         // write a file
         bool writeFile(QByteArray &data, QString remotename, RideFile *ride);
 
diff --git a/src/Resources/application.qrc b/src/Resources/application.qrc
index 3fae9b8da..86fbdf032 100644
--- a/src/Resources/application.qrc
+++ b/src/Resources/application.qrc
@@ -167,6 +167,7 @@
         <file>web/googlemap/dark.css</file>
         <file>images/toolbar/cloud.png</file>
         <file>images/services/strava_compatible.png</file>
+        <file>images/services/strava_connect.png</file>
         <file>images/services/cyclinganalytics.png</file>
         <file>images/services/dropbox.png</file>
         <file>images/services/googledrive.png</file>
diff --git a/src/Resources/images/services/strava_connect.png b/src/Resources/images/services/strava_connect.png
new file mode 100644
index 000000000..868c433da
--- /dev/null
+++ b/src/Resources/images/services/strava_connect.png
@@ -0,0 +1,15 @@
+�PNG
+
+   IHDR   �   0   ��    sRGB ���  IDATx�\w�U���G]H��K���
+d�"�# %H���a21[��h2�0�DM4ь�$C�1F:�DI����/{O����\���f�/�y{O�������{��<<<<<<<��9`b�g=��u���@�怕�G��ұ-�}���S���J�*U'�竞%����_	=���=Q6B0(�-A������K������@&q�ʕ+˔)SO����A������GρL�1�����[��qPĺ}�s #8�"�qd��&<��A:��c3�y[����A:��c3�y[����A:��c3�y[����A:��c3�y[����A:��c3��H3r��K�:}�4.^���5k^sYA��ѣ�X�"*T�k.7I;V��� �:ԨS�1��(S�jpp�'ʪdU��l��5������Z�<�b&̃���=�G;!s���d�X��\� �M��W��b���Ǳx�b9r�V*�ի���ۣ\9�!%�>���ˣr��E��+Wb�֭x�'�H$p��e�WժUCٲe��ΝäI�СC�n����=��[�����o��Vf����=��Z��x����Q[��0������޻@�{�6W�����S�FjS�j؜KZNy	f���P�9!xstX/��
+��/�*/O	���P,����1q�D�fw�ujժ�͛7c��頖+I4c��_��Ȗܼyst��]�I��L��cǎ��5�\�. ��R3��4�m�6g٭K<'Z}���ޓ�a����/a?�#P�n�"䍲S�ΝJ֬��dlx�i�h�Q,�l�Ma�MĲ�7�X@0�|�G98p :w={�m۶z÷o��K���ƍ�`�4��?^�N�<�6���k�.�޽�R��|�rP�FI^W .\�k׮UW$���Ν;��+V��ٳ���F�RSs�<�I>���M���3g����:�O�@�|��$����x�5�<�ڷmۦ{g_�
+�.��#��	qEL�N0rHf�X�l��by�gR^���Z�I�MM�,����:�J����6��K�7�-�N��A?�)]F�Y���ϛ �����З�|,V ��	����>�.�	O�:�7�e˖�Ӻ��6m
+�9w��@�O��/��>`� �v���� P ��9ڵk��R�O�8��#J�ҥK*��VׂB3m�4Х�R��
+��u�п�pm�g���5x��k��d���L���	ݖ(Q�/Z����W��k�.\�ur���C�.]P�vm��ڢE/-$�m�h�֬Y��g;�q��U(� )�C��Uu#���`�wN���1L�����>+�<�̣?R���}c�+�11n�jul_���N
+ ���������}x������Z��;����>;�-]����p�i�hq?�~.��BZ<Y��:�A˰�8
+�a_ȫPHIU�VM��BF7��B�o̱}��Ő!CЯ_?P��=J��~;F���Ç��m�rU{P8�>}�`���jm(��N�40-ѠA��:��h1H{��U�d�2l�0�'�V�Z���,�3Fݖf͚i��'�z$��D�R�R%�R��J��U=F��5�ѣ�6=���z�h L��9#F�P��s;+��%�ir���j^T��]IZ�p����t�����ɸE�/�Nc'�	{1f�i�]3�zA�RR�ڳ'��W��ṡ�i~ދ��	O*�B���'Q@�G�j 'D̖PS�=J�7�����nݺ������v[(`�?H�s1('���S�S@�¸~��U�VZ�����;�4�x�?)]?���nP׮]��
+����:ӥ��Ec�� �B�¤�dk#^Iib��zn[����"x��|'\���m�lG��Ots_��Y"�v�;�f���b��Z$P@��0��m-��E��#�"7b��D[]�k.�c���BF� D�iA�̌�X�`G�u�G��.O����(�="1v��sP�I����8"�X�[�zu�'P��%�ui	8�PA{sJ&:����`f%�eS�1�[�h�k��ݾR�e���݆����AǞ?�e#�Xs�}Z�;A�_Q�f�O�%�3F$�iIh�F0U�<�~��Sސ"=\��E4-�&�]4�c���0pe�1h2C�N*� ��n�s1.x衇�ݢ�թS'<��#:��t/h)1S�X��<��=Қ��5�.jq�1KA��;�YL�i�Jv�'���U�>���z{%}�J�n�����jy��q�mX������kt�t첟������ߪq	(�]���:�i���m����>���º��	 �9���2�B�b�z�j���-�M��bΜ9��ϝ;Wc�_Іo$��s�s�f��1�2y�d��9�I�&�.18޳g�f�辸|=�в���,l�A@��~� �=K�@�l�2����Ty�طG��?#x�Y2p�f�2p�s�moX����v����f幄��k�3�ì�`a6�A���Jk A��A�;bu�X �e2���t	��I�*5u+�,�N͛��E�����(5,�{�ҥ����K�c������Ř9s�jM�Q)��"�5]���ݱF��֭��l�ԩa�M�6:������Y�4n`��OԱcGu�d_���?�@t�(���"f���1���R����OO�@6�2��_��]��p*S�L�T-v�LA@�xj\J��~(�$[d'�&���-O������o,}�;���?X�M�v@�^�,�.��m�� 	q�����3a��|�]�^+��J�yQj{��ѬGtJ�?	
+d���)l�ژ�`,p�kXZ�E�ZѤv�8س'�-��m�|�ۺ��>q?r������,������'ƥ������5�_t�`�5
+�b�'�X�Z�����pA��4g��I�|�/~t�`죰�&�9F �'� ����񆰒~%%��\�?�<��$5���Y�?7��+l_�ܽdkP�:]��Ezb_�x��ɽ��8G��!�BL�J��Ot�
+���Q:��<��e-�Ѝ��y�՟���eZ�;��r8��8���$�<
+�@z��@1Q�7�w�9�.<���q� ȸ[�7�.<���q� ȸ[�7�.<���q� ȸ[�7�.<���q� ȸ[�7�.<���q���ʗKG3n�~C�yȓ���ymq��X/3��ʵ�s��)��'�)�e���wȏ�>���ɓ�@�� ��E���͖Wb�r�i�x_���s��r�@�����D%wK~������� X�c�    IEND�B`�
\ No newline at end of file
